Ext.ns("crs.grid");

crs.grid.ReviewedAlterationGridPanel = Ext.extend(Ext.grid.EditorGridPanel,
		{

			/* begin of fields initialization */
			autoHeight : true,
			default_url : 'review_reviewedAlterations.do',
			defaultProxy : '',
			pageSize : 15,
			closable : true,
			params : '',
			root : 'listCopyrightAlteration',
			totalProperty : 'pagination.totalCount',
			title : '著作权变更或补充申请审核记录',
			viewConfig : {
				deferEmptyText : false,
				emptyText : '没有可显示数据',
				forceFit : true
			},
			params : {},
			defaultProxy : {},
			fields : [ 'id','copyrighter' ,'softFullName' ,'state'],
			columns : [ {
				header : 'id',
				hidden : true,
				dataIndex : 'id'
			}, {
				header : '著作权人',
				dataIndex : 'copyrighter'
			}, {
				header : '软件名称/版本号',
				dataIndex : 'softFullName'
			} , {
				header : '状态',
				dataIndex : 'state',
				renderer : function(v) {
					if (!v)
						return '待审核';
					if (v == 1) {
						return '待审核';
					} else if (v == 2) {
						return '审核通过';
					} else {
						return "审核不通过";
					}
				}
			} ],
			sm : new Ext.grid.RowSelectionModel({
				singleSelect : true
			}),
			initComponent : function() {
				this.buildProxies();
				this.params = this.buildParams();
				this.store = this.buildStore();
				// this.columns = this.buildColumns();
				this.bbar = this.buildBbar();
				crs.grid.ReviewedAlterationGridPanel.superclass.initComponent
						.call(this);

				this.store.load(this.params);
			},
			/* end of components appending to this panel */
			buildStore : function() {

				return new Ext.data.Store({
					proxy : this.defaultProxy,
					reader : new Ext.data.JsonReader({
						root : this.root,
						totalProperty : this.totalProperty,
						fields : this.fields
					})
				});

			},

			buildProxies : function() {

				this.defaultProxy = new Ext.data.HttpProxy({
					url : this.default_url,
					method : 'post'
				});
			},
			buildBbar : function() {
				return new Ext.PagingToolbar({
					store : this.store,
					pageSize : this.pageSize,
					displayInfo : true
				});
			},
			buildParams : function() {
				var dataPost = {};
				dataPost.params = {};
				dataPost.params.start = 0;
				dataPost.params.limit = this.pageSize;
				return dataPost;
			}

		/* end of handler implementation */
		});

Ext.reg("alteration_reviewed_grid", crs.grid.ReviewedAlterationGridPanel);